//
//  USEmjoCell.m
//  us
//
//  Created by karry on 2025/4/11.
//

#import "USChatEmojiCell.h"

@implementation USChatEmojiCell

- (void)setupView{
    [super setupView];
 
    self.emjoImageView = [[UIImageView alloc]initWithImage:nil];
    self.emjoImageView.layer.cornerRadius = 14;
    self.emjoImageView.layer.masksToBounds = YES;
    [self.messageContentView addSubview:self.emjoImageView];
    self.emjoImageView.contentMode = UIViewContentModeScaleAspectFit;
    [self.emjoImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.top.bottom.mas_offset(0);
        make.width.mas_equalTo(ScreenWidth * 0.17);
        make.height.mas_equalTo(ScreenWidth * 0.17);
    }];
    
}

- (void)setMessageViewModel:(USMessageViewModel *)messageViewModel{
    [super setMessageViewModel:messageViewModel];

    
    EMChatMessage *message = messageViewModel.message;
    EMCustomMessageBody *body = (EMCustomMessageBody *)message.body;

    USChatCustomModel *model = [USChatCustomModel mj_objectWithKeyValues:body.customExt];
           
    [self.emjoImageView setImage:[UIImage imageNamed:model.localName]];
 
    
}

- (void)updateLayout{

    [super updateLayout];
    
    [self.emjoImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
        make.right.left.top.bottom.mas_offset(0);
        make.width.mas_equalTo(ScreenWidth * 0.17);
        make.height.mas_equalTo(ScreenWidth * 0.17);
    }];
}
 

@end
